<?
$projects = $this->projects;
?>

<table class="table4admin">
    <thead>
    <tr>
        <td>Title</td>
        <td>Content</td>
        <td>Image</td>
        <td>Views</td>
        <td>Public</td>
        <td></td>
        <td></td>
    </tr>
    </thead>

    <tbody>
    <? foreach ($projects as $record): ?>
    <tr>
        <td><?= $record['title'] ?></td>
        <td><?= $this->truncate(strip_tags($record['content'])) ?></td>
        <td>
            <? if (!empty($record['img'])): ?>
            <a href="<?= $record['img'] ?>"><img src="<?= $record['img'] ?>" alt="<?= $record['title'] ?>"
                                                 width="40px"/></a>
            <? endif;?>
        </td>
        <td>
            <?= $record['views'] ?>
        </td>
        <td>
            <? $checked = $record['public'] ? "checked" : null ?>
            <input type="checkbox" <?= $checked ?> disabled="true"/>
        </td>
        <td><a href="/projects/edit/id/<?= $record['id'] ?>">Edit</a></td>
        <td><a href="/projects/delete/id/<?= $record['id'] ?>" class="delete">Delete</a></td>
    </tr>
        <? endforeach; ?>
    </tbody>
</table>

<a href="/projects/add">Add article</a>

<?php echo $this->paginationControl($this->paginator, 'Sliding', 'projects/controls.phtml'); ?>